<?php

namespace app\admin\validate;

use think\Validate;

class AdminUser extends Validate
{

    //规则
    protected $rule = [
        'username' => 'require',
        'password' => 'require',
//        'captcha'  => 'require|checkCapcha',
    ];

    //返回提示信息
    protected $message = [
        'username' => '用户名必须',
        'password' => '密码必须',
//        'captcha'  => '验证码必须',
    ];

    //检测验证码
    protected function checkCapcha($value, $rule, $data = [])
    {
        if (!captcha_check($value)) {
            return '验证码不正确';
        }
        return true;
    }

}